#include <QtGui/QApplication>
#include "mainwindow.h"
#ifdef Q_OS_SYMBIAN
#include <eikenv.h>
#include <coemain.h>
#include <aknappui.h>
#endif
#include <QTextCodec>
#include <QSplashScreen>

#include "testwindow.h"

#include <QTranslator>
#include <QLocale>
#include "toolkit.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTextCodec *codec = QTextCodec::codecForName("GBK");
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForTr(codec);

    #ifdef Q_OS_SYMBIAN
        CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
        if (aknAppUi)
            aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
    #endif

    QLocale locale(QLocale::system());
    ToolKit::m_language = static_cast<int>(locale.language());

    QString strlocale = QLocale::system().name();
    QTranslator translator;
    translator.load(QString("helloworld_") + strlocale);
    a.installTranslator(&translator);

    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap(":/image/splash.png","png"));
    splash->setWindowFlags(Qt::Window);
    splash->showFullScreen();
    a.processEvents();
    MainWindow w;
    w.showFullScreen();
    splash->finish(&w);
    delete splash;

//        testWindow w;
//        w.showFullScreen();


    return a.exec();
}
